package shili;

import java.util.Scanner;

public class Demo {
    public static void main(String[] args) {

        int choose=0;             //选择的结算分类编号
        int price=0;              //费用单价
        int total=0;              //总计金额
        String name="";           //费用名称
        int num=0;                //数量
        Scanner input=new Scanner(System.in);
        System.out.println("**************订单结算******************");
        String answer="y";
        while (answer.equals("y")){
            System.out.println("1.交通类  2.住宿类  3.门票类");
            System.out.print("请选择结算分类编号:");
            choose=input.nextInt();
            switch (choose){
                case 1:
                    name="机票: 北京-丽江";
                    price=1100;
                    break;
                case 2:
                    name="古城酒店 三人间";
                    price=200;
                    break;
                case 3:
                    name="玉龙雪山 套票";
                    price=445;
                    break;
            }
            System.out.println("请输入数量:");
            num=input.nextInt();
            total+=price*num;
            System.out.println(name+"\t"+price*num+"元。");
            System.out.println("**************");
            System.out.print("是否继续(y/n):");
            answer=input.next();
        }
        System.out.println("本次结算总金额((元):"+total);
        System.out.println("结算完毕，祝您旅途愉快!");
    }
}
